using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Resources;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace KPIS.GERP.Models.ICM
{
	[DataContract, Table("IcmMasResourceGroup")]
    public class MasResourceGroup
    {

        public MasResourceGroup()
        {
            //this.MasResourceSubGroups = new HashSet<MasResourceSubGroup>();
        }
    

		[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
		[DataMember, Display(Name = "ResGrpId", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public int ResGrpId { get; set; }

		[DataMember, Display(Name = "Code", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public string Code { get; set; }

		[DataMember, Display(Name = "OldCode", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public string OldCode { get; set; }

		[DataMember, Display(Name = "Name", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public string Name { get; set; }

		[DataMember, Display(Name = "Descr", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public string Descr { get; set; }

        [ForeignKey("MasResourceType")]
		[DataMember, Display(Name = "ResTypeId", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<int> ResTypeId { get; set; }

		[DataMember, Display(Name = "MinPriceCalDepreciation", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<double> MinPriceCalDepreciation { get; set; }

        [ForeignKey("MasDepreciationType")]
        [DataMember, Display(Name = "DpTypeId", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<int> DpTypeId { get; set; }

		[DataMember, Display(Name = "RecordStatus", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public string RecordStatus { get; set; }

		[DataMember, Display(Name = "CreatedBy", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<int> CreatedBy { get; set; }

		[DataMember, Display(Name = "CreatedWhen", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<System.DateTime> CreatedWhen { get; set; }

		[DataMember, Display(Name = "UpdatedBy", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<int> UpdatedBy { get; set; }

		[DataMember, Display(Name = "UpdatedWhen", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<System.DateTime> UpdatedWhen { get; set; }


		[ForeignKey("AssetAccount")]
		[DataMember, Display(Name = "AssetAccountId", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<int> AssetAccountId { get; set; }

		[ForeignKey("CumdepreAccount")]
		[DataMember, Display(Name = "CumdepreAccountId", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<int> CumdepreAccountId { get; set; }

		[ForeignKey("DepreAccount")]
		[DataMember, Display(Name = "DepreAccountId", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<int> DepreAccountId { get; set; }

		[ForeignKey("BreakAccount")]
		[DataMember, Display(Name = "BreakAccountId", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<int> BreakAccountId { get; set; }

		[ForeignKey("ConsumeAccount")]
		[DataMember, Display(Name = "ConsumeAccountId", ResourceType = typeof(Resources.MasResourceGroupResource))]
        public Nullable<int> ConsumeAccountId { get; set; }
    

        //[DataMember]
        //public virtual ICollection<MasResourceSubGroup> MasResourceSubGroups { get; set; }

        [DataMember]
        public virtual MasResourceType MasResourceType { get; set; }

        [DataMember]
        public virtual MasDepreciationType MasDepreciationType { get; set; }

        [DataMember]
        public virtual ACM.MasAccount AssetAccount { get; set; }

        [DataMember]
        public virtual ACM.MasAccount DepreAccount { get; set; }

        [DataMember]
        public virtual ACM.MasAccount BreakAccount { get; set; }

        [DataMember]
		public virtual ACM.MasAccount ConsumeAccount { get; set; }

        [DataMember]
        public virtual ACM.MasAccount CumdepreAccount { get; set; }
        
	    [DataMember, NotMapped] public int AmountOfSubGroup { get; set; } // ViewModel
    }
}